object t1 {
  def checkGrade(score: Int): String = {
    score match {
      case s if s >= 90 && s <= 100 => "优+"
      case s if s >= 80 && s < 90 => "优"
      case s if s >= 60 && s < 80 => "良"
      case s if s < 60 => "差"
      case _ => "无效成绩"
    }
  }

  def main(args: Array[String]): Unit = {
    var input = -1
    while (input != 0) {
      println("请输入成绩（输入0退出）：")
      input = scala.io.StdIn.readInt()
      if (input != 0) {
        val grade = checkGrade(input)
        println(s"该成绩的等级为: $grade")
      } else {
        println("退出查询系统")
      }
    }
  }
}
